import Vue from 'vue';
import VueRouter from 'vue-router';
Vue.use(VueRouter)
import ElementUI from 'element-ui';
Vue.use(ElementUI)
import 'element-ui/lib/theme-chalk/index.css';
import jQuery from 'jquery'
import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.min'

import axios from 'axios';
import AuthPanel from 'auth-panel';
import routes from './views/routes';
var router = new VueRouter({routes:routes});
import Header from './views/header';

Vue.config.debug = true; //开启错误提示


new Vue({
	el: '#product-mng', 
	data(){
		return {
			unAuthorized: false,
		};
	},
	router: router,
	components:{
		'header-top': Header,
		'auth-panel': AuthPanel
	},
	created(){
		var vm = this;
		axios.interceptors.response.use(data=> {
			return data;
		}, err => {
			if (err.response.data.unAuthorizedRequest) vm.unAuthorized = true;
			return Promise.reject(err);
		});
	},
});